package com.yuke.cloud.service.wmc.controller.frontend;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yuke.cloud.common.base.enums.ErrorCodeEnum;
import com.yuke.cloud.common.core.annotation.LogAnnotation;
import com.yuke.cloud.common.core.support.BaseController;
import com.yuke.cloud.common.util.wrapper.WrapMapper;
import com.yuke.cloud.common.util.wrapper.Wrapper;
import com.yuke.cloud.service.api.omc.service.OmcOrderFeignApi;
import com.yuke.cloud.service.api.pmc.dto.ProdSpecInfoDto;
import com.yuke.cloud.service.api.pmc.service.PmcFeignApi;
import com.yuke.cloud.service.wmc.dto.WmsStockInDto;
import com.yuke.cloud.service.wmc.entity.AssGoodsReturn;
import com.yuke.cloud.service.wmc.entity.WmsGoodsTransfer;
import com.yuke.cloud.service.wmc.entity.WmsStockIn;
import com.yuke.cloud.service.wmc.entity.WmsStorage;
import com.yuke.cloud.service.wmc.service.AssGoodsReturnService;
import com.yuke.cloud.service.wmc.service.WmsGoodsTransferService;
import com.yuke.cloud.service.wmc.service.WmsStockInService;
import com.yuke.cloud.service.wmc.service.WmsStorageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.*;

/**
 * Created by zys on 2018/12/06.
 */
@Api(value = "WEB - WmsStockInController", tags = "处理WmsStockIn相关请求", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RestController
@RequestMapping("/wms/stock_in")
public class WmsStockInController extends BaseController {
    @Resource
    private WmsStockInService wmsStockInService;
    @Resource
    private WmsStorageService wmsStorageService;
    @Resource
    private PmcFeignApi pmcFeignApi;
    @Resource
    private AssGoodsReturnService assGoodsReturnService;
    @Resource
    private WmsGoodsTransferService wmsGoodsTransferService;
    @Resource
    private OmcOrderFeignApi omcOrderFeignApi;

    @PostMapping
    @LogAnnotation
    @ApiOperation(httpMethod = "POST", value = "新增一条记录")
    public Wrapper add(@ApiParam(name = "wmsStockIn", value = "该数据记录的POJO") @RequestBody WmsStockIn wmsStockIn) {
        //如果是退货入库，先判断商家是否允许退货，如果不允许在推出去
        if (wmsStockIn == null) {
            return WrapMapper.error();
        }
        Long userId = getLoginAuthDto().getUserId();

        Byte inType1 = wmsStockIn.getInType();
        if (inType1.toString().equals("2")) {
            AssGoodsReturn assGoodsReturn = new AssGoodsReturn();
//            assGoodsReturn.setOrderId(wmsStockIn.getGoodsReturnId());
            assGoodsReturn.setGoodsReturnId(wmsStockIn.getGoodsReturnId());
            assGoodsReturn.setOrderGoodsId(wmsStockIn.getSpecId());
            List<AssGoodsReturn> select = assGoodsReturnService.select(assGoodsReturn);

            if (select == null || select.size() <= 0) {
                throw new RuntimeException("退货单不存在");
            }
            AssGoodsReturn byId = select.get(0);
            String s = byId.getReturnStatus().toString();
            if (s.equals("7")) {
                throw new RuntimeException(ErrorCodeEnum.WMC100500019.msg());
            }else if (s.equals("5")) {
                throw new RuntimeException("退货申请待确认");
            }else if (s.equals("2") || s.equals("3") || s.equals("4")) {
                throw new RuntimeException("已完成过质检，无法再入库");
            }
        } else if (inType1.toString().equals("1")) {  // 调货入库校验 add by wg 20190325
            Example example = new Example(WmsGoodsTransfer.class);
            Example.Criteria criteria = example.createCriteria();
            criteria.andEqualTo("transferId", wmsStockIn.getTransOrderId());
            criteria.andEqualTo("transferStatus", 1);
            List<WmsGoodsTransfer> wmsGoodsTransfer  = wmsGoodsTransferService.selectByExample(example);

            if (wmsGoodsTransfer == null || wmsGoodsTransfer.size() <= 0) {
                throw new RuntimeException("调货单不存在");
            }

            if (wmsStockIn.getInNumber().intValue() > wmsGoodsTransfer.get(0).getTransferNum().intValue()) {
                throw new RuntimeException("入库数量与调货单数量不符");
            }
        }
        wmsStockIn.setUpdateId(userId);
        wmsStockInService.save(wmsStockIn);
        WmsStorage wmsStorage = new WmsStorage();
        wmsStorage.setSpecId(wmsStockIn.getSpecId());
        //
        wmsStorage.setWarehouseId(wmsStockIn.getWarehouseId());

        List<WmsStorage> select = wmsStorageService.select(wmsStorage);

        if (select.size() < 1) {
            wmsStorage.setSpecName(wmsStockIn.getSpecName());
            wmsStorage.setProductId(wmsStockIn.getProductId());
            wmsStorage.setCategoryId(wmsStockIn.getCategoryId());
            wmsStorage.setBrandId(wmsStockIn.getBrandId());
            wmsStorage.setNumber(wmsStockIn.getInNumber());
            wmsStorage.setStockinDate(wmsStockIn.getInboundTime());
            wmsStorage.setMfgDate(wmsStockIn.getMfgDate());
            wmsStorage.setQuality(wmsStockIn.getQuality());
            //采购入库 add by wg 20190320 用最新的采购价格代替原有价格
            if (wmsStockIn.getInType().toString().equals("0")) {
                wmsStorage.setPurchasePrice(wmsStockIn.getSupplyPrice());
            }

            wmsStorage.setUpdateId(userId);
            wmsStorage.setUpdateTime(new Date());
            wmsStorageService.save(wmsStorage);
        } else if (select.size() > 0) {
            WmsStorage wmsStorage1 = select.get(0);
            Integer number = wmsStorage1.getNumber();
            wmsStorage1.setNumber(number + wmsStockIn.getInNumber());

            if (wmsStockIn.getQuality() != null &&  wmsStockIn.getQuality() != 0){
                wmsStorage1.setQuality(wmsStockIn.getQuality());
            }


            //采购入库 add by wg 20190320 用最新的采购价格代替原有价格
            if (wmsStockIn.getInType().toString().equals("0")) {
                if(wmsStockIn.getSupplyPrice() > 0){
                    wmsStorage1.setPurchasePrice(wmsStockIn.getSupplyPrice());
                }
                //todo 进货写入生产日期
                if(wmsStorage1.getRemainder() < 1 ){
                    wmsStorage1.setMfgDate(wmsStockIn.getMfgDate());//生产日期
                    wmsStorage1.setRemainder(number-wmsStorage1.getLockNumber()+ wmsStockIn.getInNumber());//旧货数
                    wmsStorage1.setStockinDate(wmsStockIn.getInboundTime());//入库日期
                }
            }

            wmsStorage1.setUpdateId(userId);
            wmsStorage1.setUpdateTime(new Date());
            wmsStorageService.update(wmsStorage1);

        }


        Byte inType = wmsStockIn.getInType();
        //采购入库
        if (inType.toString().equals("0")) {

        } else if (inType.toString().equals("2")) {
            //订单id
            Long goodsReturnId = wmsStockIn.getGoodsReturnId();
            Example example = new Example(AssGoodsReturn.class);
            Example.Criteria criteria = example.createCriteria();
//            criteria.andEqualTo("orderId", goodsReturnId);
            criteria.andEqualTo("goodsReturnId", goodsReturnId);
            List<AssGoodsReturn> assGoodsReturns = assGoodsReturnService.selectByExample(example);

            if (assGoodsReturns != null && assGoodsReturns.size() > 0) {
                // add by wg 20190711 增加货到付款方式处理
                if (assGoodsReturns.get(0).getRefundPayable() == 0) {  // 货到付款方式时，此时应退款为0
                    omcOrderFeignApi.changetorefund(assGoodsReturns.get(0).getOrderId(), 0.0);

                    assGoodsReturns.get(0).setReturnStatus((byte) 4);
                    assGoodsReturns.get(0).setIsRefund(false);
                    assGoodsReturns.get(0).setRefundPaid(0);
                    assGoodsReturns.get(0).setUpdateTime(new Date());
                } else {
                    assGoodsReturns.get(0).setReturnStatus((byte) 2);
                    assGoodsReturns.get(0).setUpdateTime(new Date());
                }

                assGoodsReturnService.update(assGoodsReturns.get(0));

                // add by wg 20190327 退货时，应该将店铺的线上库存还原
                if (assGoodsReturns.get(0).getOrderType() == 1)  // 消费者向店铺下单退货时才还原店铺线上库存
                {
                    List<Map> list = new ArrayList<>();
                    Map<String, String> map = new HashMap();
                    map.put("shopId", assGoodsReturns.get(0).getShopId().toString());
                    map.put("specId", assGoodsReturns.get(0).getOrderGoodsId().toString());
                    map.put("goodsNum", wmsStockIn.getInNumber().toString());
                    list.add(map);
                    String s = JSON.toJSONString(list);
//                smcFeignApi.updateStockCount(s);  // V1.1版店铺没有线上库存
                }
            }
        } else if (inType.toString().equals("1")) {  //调货入库
            Long transOrderId = wmsStockIn.getTransOrderId();
            WmsGoodsTransfer byId = wmsGoodsTransferService.findById(transOrderId);

            //+   -
            Long beTransferedWarehouseId = byId.getBeTransferedWarehouseId();
            Long transferSpecId = byId.getTransferSpecId();
            //Integer transferNum = byId.getTransferNum();
            Integer inNumber = wmsStockIn.getInNumber();
            wmsStorageService.updatewarehousestoragefnum(beTransferedWarehouseId, transferSpecId, inNumber);
            WmsGoodsTransfer wmsGoodsTransfer = new WmsGoodsTransfer();
            // mod by wg 20190325
//            wmsGoodsTransfer.setTransferId(transferSpecId);
            wmsGoodsTransfer.setTransferId(transOrderId);
            wmsGoodsTransfer.setTransferStatus((byte) 3);
            wmsGoodsTransfer.setTransferNumReal(inNumber);

            wmsGoodsTransferService.update(wmsGoodsTransfer);
        }

        return WrapMapper.ok(wmsStockIn);
    }


    @DeleteMapping("/{id}")
    @LogAnnotation
    @ApiOperation(httpMethod = "DELETE", value = "根据id删除一条记录")
    public Wrapper delete(@ApiParam(name = "id", value = "记录id") @PathVariable Long id) {

        // mod by wg 20190514
        // 从数据库中获取现有数据
        WmsStockIn wmsStockIn = wmsStockInService.findById(id);
        if (wmsStockIn == null) {
            return WrapMapper.error("无法找到该条记录");
        }

        Byte inType = wmsStockIn.getInType();
        if (inType.toString().equals("0")) { // 新增入库修改情况
            // 修改库存量及价格
            Integer number = -wmsStockIn.getInNumber();
            wmsStorageService.updateStorageData(wmsStockIn.getWarehouseId(), wmsStockIn.getSpecId(), number, null,null);
        } else if (inType.toString().equals("1")) { // 其他仓库调配入库
            Integer number = -wmsStockIn.getInNumber();
            // 被调仓库减少存在
            Long transOrderId = wmsStockIn.getTransOrderId();
            WmsGoodsTransfer byId = wmsGoodsTransferService.findById(transOrderId);
            //+   -
            Long beTransferedWarehouseId = byId.getBeTransferedWarehouseId();
            Long transferSpecId = byId.getTransferSpecId();
            wmsStorageService.updatewarehousestoragefnum(beTransferedWarehouseId, transferSpecId, number);

            WmsGoodsTransfer wmsGoodsTransfer = new WmsGoodsTransfer();
            // mod by wg 20190325
//            wmsGoodsTransfer.setTransferId(transferSpecId);
            wmsGoodsTransfer.setTransferId(transOrderId);
            wmsGoodsTransfer.setTransferStatus((byte) 1);
            wmsGoodsTransfer.setTransferNumReal(0);

            wmsGoodsTransferService.update(wmsGoodsTransfer);

            // 修改库存量
            wmsStorageService.updateStorageData(wmsStockIn.getWarehouseId(), wmsStockIn.getSpecId(), number, null, null);
        } else if (inType.toString().equals("2")) {  // 退货入库情况
            Integer number = -wmsStockIn.getInNumber();
            //
            Long goodsReturnId = wmsStockIn.getGoodsReturnId();
            Example example = new Example(AssGoodsReturn.class);
            Example.Criteria criteria = example.createCriteria();
//            criteria.andEqualTo("orderId", goodsReturnId);
            criteria.andEqualTo("goodsReturnId", goodsReturnId);
            List<AssGoodsReturn> assGoodsReturns = assGoodsReturnService.selectByExample(example);
            assGoodsReturns.get(0).setReturnStatus((byte) 1);
            assGoodsReturnService.update(assGoodsReturns.get(0));

            // add by wg 20190327 退货时，应该将店铺的线上库存还原
            if (assGoodsReturns.get(0).getOrderType() == 1)  // 消费者向店铺下单退货时才还原店铺线上库存
            {
                List<Map> list = new ArrayList<>();
                Map<String, String> map = new HashMap();
                map.put("shopId", assGoodsReturns.get(0).getShopId().toString());
                map.put("specId", assGoodsReturns.get(0).getOrderGoodsId().toString());
                map.put("goodsNum", number.toString());
                list.add(map);
                String s = JSON.toJSONString(list);
//               smcFeignApi.updateStockCount(s); // V1.1版店铺没有线上库存
            }

            // 修改库存量
            wmsStorageService.updateStorageData(wmsStockIn.getWarehouseId(), wmsStockIn.getSpecId(), number, null, null);
        }

        wmsStockInService.deleteById(id);
        return WrapMapper.ok();
    }

    @PutMapping
    @LogAnnotation
    @ApiOperation(httpMethod = "PUT", value = "修改一条记录")
    public Wrapper update(@ApiParam(name = "wmsStockIn", value = "需要修改的内容") @RequestBody WmsStockIn wmsStockIn) {

        // mod by wg 20190514
        // 只允许修改入库数量、采购价格及入库时间，在前端页面要做限制
        // 如果是退货入库，先判断商家是否允许退货，如果不允许在推出去
        if (wmsStockIn == null || wmsStockIn.getStockInId() == null) {
            return WrapMapper.error("参数错误");
        }
        Long userId = getLoginAuthDto().getUserId();
        // 从数据库中获取现有数据
        WmsStockIn wmsStockInOld = wmsStockInService.findById(wmsStockIn.getStockInId());
        if (wmsStockInOld == null) {
            return WrapMapper.error("无法找到该条记录");
        }

        if (!wmsStockIn.getWarehouseId().equals(wmsStockInOld.getWarehouseId()) || !wmsStockIn.getSpecId().equals(wmsStockInOld.getSpecId())
                || !wmsStockIn.getInType().equals(wmsStockInOld.getInType())) {
            return WrapMapper.error("只能修改入库数量、采购价格和入库时间");
        }

        Byte inType = wmsStockIn.getInType();
        if (inType.toString().equals("0")) { // 新增入库修改情况
            // 修改库存量及价格
            Integer number = wmsStockIn.getInNumber() - wmsStockInOld.getInNumber();
            Integer PurchasePrice = wmsStockIn.getSupplyPrice();
            Integer quality = wmsStockIn.getQuality();
            wmsStorageService.updateStorageData(wmsStockInOld.getWarehouseId(), wmsStockInOld.getSpecId(), number, PurchasePrice,quality);
        } else if (inType.toString().equals("1")) { // 其他仓库调配入库
            Integer number = wmsStockIn.getInNumber() - wmsStockInOld.getInNumber();
            // 被调仓库减少存在
            Long transOrderId = wmsStockIn.getTransOrderId();
            WmsGoodsTransfer byId = wmsGoodsTransferService.findById(transOrderId);

            if (wmsStockIn.getInNumber() > byId.getTransferNum()) {
                throw new RuntimeException("入库数量与调货单数量不符");
            }
            //+   -
            Long beTransferedWarehouseId = byId.getBeTransferedWarehouseId();
            Long transferSpecId = byId.getTransferSpecId();
            wmsStorageService.updatewarehousestoragefnum(beTransferedWarehouseId, transferSpecId, number);

            // 修改库存量
            wmsStorageService.updateStorageData(wmsStockInOld.getWarehouseId(), wmsStockInOld.getSpecId(), number, null, null);
        } else if (inType.toString().equals("2")) {  // 退货入库情况
            Integer number = wmsStockIn.getInNumber() - wmsStockInOld.getInNumber();
            //
            Long goodsReturnId = wmsStockIn.getGoodsReturnId();
            Example example = new Example(AssGoodsReturn.class);
            Example.Criteria criteria = example.createCriteria();
            criteria.andEqualTo("goodsReturnId", goodsReturnId);
            List<AssGoodsReturn> assGoodsReturns = assGoodsReturnService.selectByExample(example);

            // add by wg 20190327 退货时，应该将店铺的线上库存还原
            if (assGoodsReturns.get(0).getOrderType() == 1)  // 消费者向店铺下单退货时才还原店铺线上库存
            {
                List<Map> list = new ArrayList<>();
                Map<String, String> map = new HashMap();
                map.put("shopId", assGoodsReturns.get(0).getShopId().toString());
                map.put("specId", assGoodsReturns.get(0).getOrderGoodsId().toString());
                map.put("goodsNum", number.toString());
                list.add(map);
                String s = JSON.toJSONString(list);
//                smcFeignApi.updateStockCount(s); // V1.1版店铺没有线上库存
            }

            // 修改库存量
            wmsStorageService.updateStorageData(wmsStockInOld.getWarehouseId(), wmsStockInOld.getSpecId(), number, null, null);
        }
        wmsStockIn.setUpdateId(userId);
        wmsStockIn.setUpdateTime(new Date());
        wmsStockInService.update(wmsStockIn);
        return WrapMapper.ok();
    }

    @GetMapping("/{id}")
    @ApiOperation(httpMethod = "GET", value = "根据ID获取具体信息")
    public Wrapper<WmsStockIn> detail(@ApiParam(name = "id", value = "记录id") @PathVariable Long id) {
        WmsStockIn wmsStockIn = wmsStockInService.findById(id);
        return WrapMapper.ok(wmsStockIn);
    }

    @GetMapping
    @ApiOperation(httpMethod = "GET", value = "分页获取所有记录")
    public Wrapper<PageInfo<WmsStockIn>> list
            (@ApiParam(name = "page", value = "分页值", defaultValue = "0") @RequestParam(defaultValue = "0") Integer page,
             @ApiParam(name = "size", value = "每分页返回的记录数", defaultValue = "0") @RequestParam(defaultValue = "0") Integer
                     size) {
        PageHelper.startPage(page, size);
        List<WmsStockIn> list = wmsStockInService.findAll();
        PageInfo pageInfo = new PageInfo(list);
        return WrapMapper.ok(pageInfo);
    }


    @PostMapping("/app/wmsStockIn")
    @LogAnnotation
    @ApiOperation(httpMethod = "POST", value = "新增一条记录")
    public Wrapper addWmsStockIn(@ApiParam(name = "wmsStockIn", value = "该数据记录的POJO") @RequestBody List<WmsStockIn> wmsStockInList) {
        //如果是退货入库，先判断商家是否允许退货，如果不允许在推出去
        if (wmsStockInList == null || wmsStockInList.size() < 1) {
            return WrapMapper.error();
        }
        Long userId = getLoginAuthDto().getUserId();
        for(WmsStockIn wmsStockIn : wmsStockInList){
            if (wmsStockIn.getInNumber() < 1){
                continue;
            }
            wmsStockIn.setUpdateId(userId);
            wmsStockIn.setUpdateTime(new Date());
            wmsStockInService.save(wmsStockIn);

            WmsStorage wmsStorage = new WmsStorage();
            wmsStorage.setSpecId(wmsStockIn.getSpecId());
            wmsStorage.setWarehouseId(wmsStockIn.getWarehouseId());
            List<WmsStorage> select = wmsStorageService.select(wmsStorage);

            if (select.size() < 1) {
                if (wmsStockIn.getSupplyPrice()>0) {
                    wmsStorage.setPurchasePrice(wmsStockIn.getSupplyPrice());
                }
                ProdSpecInfoDto prodSpecInfoDto = pmcFeignApi.getSpecInfoDtoBySpecId(wmsStockIn.getSpecId());
                BeanUtils.copyProperties(prodSpecInfoDto,wmsStorage);
                wmsStorage.setProductId(wmsStockIn.getProductId());
                wmsStorage.setNumber(wmsStockIn.getInNumber());
                wmsStorage.setStockinDate(wmsStockIn.getInboundTime());
                wmsStorage.setMfgDate(wmsStockIn.getMfgDate());
                wmsStorage.setQuality(wmsStockIn.getQuality());

                wmsStorage.setUpdateId(userId);
                wmsStorage.setUpdateTime(new Date());

                wmsStorageService.save(wmsStorage);
            } else if (select.size() > 0) {
                WmsStorage wmsStorage1 = select.get(0);

                if (wmsStockIn.getSupplyPrice()>0) {
                    wmsStorage.setPurchasePrice(wmsStockIn.getSupplyPrice());
                }
                Integer number = wmsStorage1.getNumber();
                wmsStorage1.setNumber(number + wmsStockIn.getInNumber());
                //todo 进货写入生产日期
                if(select.get(0).getRemainder() < 2 || select.get(0).getNumber() - select.get(0).getLockNumber() < 2){
                    wmsStorage1.setMfgDate(wmsStockIn.getMfgDate());//生产日期
                    wmsStorage1.setRemainder(select.get(0).getNumber()-select.get(0).getLockNumber());//旧货数
                    wmsStorage1.setStockinDate(wmsStockIn.getInboundTime());//入库日期
                }
                wmsStorage1.setUpdateId(userId);
                wmsStorage1.setUpdateTime(new Date());
                wmsStorageService.update(wmsStorage1);
            }else{
                return WrapMapper.error("数据库WmsStorage存在相同的商品记录");
            }
        }

        return WrapMapper.ok();
    }


    @PostMapping("/findGoodsListByPurchase")
    @ApiOperation(httpMethod = "GET", value = "根据ID获取具体信息")
    public Wrapper<PageInfo<WmsStockInDto>> findGoodsListByPurchase(
            @ApiParam(name = "page", value = "分页值", defaultValue = "0") @RequestParam(defaultValue = "0") Integer page,
            @ApiParam(name = "size", value = "每分页返回的记录数", defaultValue = "0") @RequestParam(defaultValue = "0") Integer size,
            @ApiParam(name = "wmsStockIn", value = "该数据记录的POJO") @RequestParam WmsStockInDto wmsStockInDto
    ) {

        PageHelper.startPage(page, size);

        List<WmsStockInDto> list = wmsStockInService.findGoodsListByPurchase(wmsStockInDto);

        PageInfo pageInfo = new PageInfo(list);

        return WrapMapper.ok(pageInfo);
    }

    @PostMapping("/selectWmsStockInByCondition")
    @ApiOperation(httpMethod = "POST", value = "根据ID获取具体信息")
    public Wrapper<PageInfo<WmsStockInDto>> selectWmsStockInByCondition(@ApiParam(name = "page", value = "分页值", defaultValue = "0") @RequestParam(defaultValue = "0") Integer page,
                                                           @ApiParam(name = "size", value = "每分页返回的记录数", defaultValue = "0") @RequestParam(defaultValue = "0") Integer size,
                                                           @RequestBody WmsStockInDto wmsStockInDto){

        PageHelper.startPage(page, size);

        List<WmsStockInDto> list = wmsStockInService.getWmsStockInByCondition(wmsStockInDto);

        PageInfo pageInfo = new PageInfo(list);

        return WrapMapper.ok(pageInfo);
    }

    @PostMapping("/countBySpec")
    @ApiOperation(httpMethod = "POST", value = "根据单品统计")
    public Wrapper<PageInfo<WmsStockInDto>> countBySpec(@ApiParam(name = "page", value = "分页值", defaultValue = "0") @RequestParam(defaultValue = "0") Integer page,
                                                                        @ApiParam(name = "size", value = "每分页返回的记录数", defaultValue = "0") @RequestParam(defaultValue = "0") Integer size,
                                                                        @RequestBody WmsStockInDto wmsStockInDto){

        PageInfo<WmsStockInDto> list = wmsStockInService.countBySpec(wmsStockInDto,page,size);

        return WrapMapper.ok(list);
    }

    @PostMapping("/changeCheckIn")
    @ApiOperation(httpMethod = "POST", value = "批量修改状态")
    public Wrapper changeCheckIn( @RequestBody WmsStockInDto wmsStockInDto){

        Integer result = wmsStockInService.changeCheckIn(wmsStockInDto);

        return WrapMapper.ok(result);
    }
}
